JS architecture: libs in lib directory
Fix some math imprecisions